home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / gawk-3.000 / gawk-3 / gawk-3.0.0 / test / gensub.awk < prev    next >
Encoding:
AWK Script  |  1995-08-14  |  212 b   |  7 lines

  1. BEGIN { a = "this is a test of gawk"
  2.     b = gensub(/(this).*(test).*(gawk)/, "3 = <\\3>, 2 = <\\2>, 1 = <\\1>", 1, a)
  3.     print b
  4. }
  5. NR == 1 { print gensub(/b/, "BB", 2) }
  6. NR == 2 { print gensub(/c/, "CC", "global") }
  7.